/**
 * 
 */
package br.ufal.ic.sd.project.server.core;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.Set;

import br.ufal.ic.sd.project.server.enumeration.RequestType;
import br.ufal.ic.sd.project.server.enumeration.ServiceType;
import br.ufal.ic.sd.project.server.exception.ServerException;
import br.ufal.ic.sd.project.server.factory.ServiceFactory;
import br.ufal.ic.sd.project.server.helper.Helper;
import br.ufal.ic.sd.project.server.util.Constants;

/**
 * @author keven andrade
 *
 */
public class Dispatcher {

    
    public static void execute(Server objServer){
	
	String tipoRequest = objServer.getObjChannel().read();
	
	if(tipoRequest.toUpperCase().equals(RequestType.LOG.getStrDescription())){
	    System.out.println("Log Requisition");
	    Handler.dealWithIt(ServiceFactory.getInstance(ServiceType.LOGGER.getStrDescription()), objServer);
	}
	
	if(tipoRequest.toUpperCase().equals(RequestType.TOKEN.getStrDescription())){
	    System.out.println("Token Requisition");
	    Handler.dealWithIt(ServiceFactory.getInstance(ServiceType.TOKEN.getStrDescription()), objServer);
	} 
	if(tipoRequest.toUpperCase().equals(RequestType.REPLICATION.getStrDescription())){
	    System.out.println("Replication Requisition");
	    Handler.dealWithIt(ServiceFactory.getInstance(ServiceType.REPLICATION.getStrDescription()), objServer);
	}
    }
   
}
